package com.zretc.shop.mapper.provider;

public class MySqlProvider {
    public String queryUserByNicknameAndUsernameSql(String username,String nickname) {
        String sql = "select id,username ,nickname from users ";
        sql += "where 2 > 1";
        if (username != null && !"".equals(username)) {
            sql += "and username like '%" + username + "%'  ";
        }
        if (nickname != null && !"".equals(nickname)) {//既不是nLL 也不是空字符串 表示需要这个条件"
            sql += "and nickname like '%" + nickname + "%' ";
        }
        return sql;
    }
}
